import {
	defineStore
} from 'pinia'

export const assistObj = {
	//  派单对象类型
	sendObjType: '',
	// 派单对象标识
	sendObjId: '',
	// 派单所属小组
	sendTeam: '',
	// 协作说明
	content: '',
	// 协作附件
	assistEnclosure: [],
	sendLabel: ''
}
export const useHandleWorkOrder_Cooperation = defineStore('useHandleWorkOrder_Cooperation', {
	state: () => ({
		choseUserIndex: -1,
		fileList: [],
		fileSubList: [],
		formData: {
			orderNum: '',
			/**
			 * 公共附件
			 */
			assistEnclosure: [],
			// 协作说明
			assistRemark: '',
			/**
			 * 协作集合
			 */
			assistList: [assistObj],
		}
	}),
	actions: {
		onDelFile(index) {
			this.fileList.splice(index, 1)
		},
		onDelItem(sind, ind) {
			this.formData.assistList[ind].assistEnclosure.splice(sind, 1)
		}
	},
	persist: true,
})